import { defHttp } from "@/utils/http";

export interface PatientsVO {
	patientId: string; //病人唯一标识ID
	patCardno: string; //医保卡号
	citizenId: string; //身份证号码
	fullName: string; //病人全名
	birthday: string; //出生日期
	gender: string; //性别（M: 男, F: 女, Other: 其他）
	birthyear: string; //出生年份
	occupation: string; //职业
	ethnicity: string; //民族
	nationality: string; //国籍
	phoneNumb: string; //联系电话
	mobileNumb: string; //固定电话
	emailAddr: string; //邮箱地址
	addrHouseno: string; //户口-门牌号
	addrProvince: string; //省份
	addrCity: string; //城市
	addrDistrict: string; //区/县
	addrCommune: string; //社区
	addrWard: string; //街道/乡镇
	// createdBy: string; //创建者
	// createdTime: string; //创建时间
	// updatedBy: string; //更新者
	// updatedTime: string; //更新时间
	age: number; //年龄
	status: number; //状态
}

export interface PatientsPageReqVO extends PageParam {
	deptId?: number;
	username?: string;
	mobile?: string;
	patientId?: string;
	status?: number;
	createTime?: Date[];
}

// 获得病人基本信息分页
export function getPatientsPage(params: PatientsPageReqVO) {
	return defHttp.get<QueryListResVo>({ url: "/his/th-patients/page", params });
}
// 综合查询详细患者信息
export function getPatientsPage_list(params: any) {
	return defHttp.get({
		url: "/his/patient/synthesis/patient/get",
		params
	});
}

// 获得病人基本信息
export function get_patients(params: any) {
	return defHttp.get({ url: "/his/th-patients/get", params });
}
// 创建病人基本信息
export function createPatients(data: PatientsVO) {
	return defHttp.post({ url: "/his/th-patients/create", data });
}

// 更新病人基本信息
export function put_patients(data: any) {
	return defHttp.put({ url: "/his/th-patients/update", data });
}
// 更新病人基本信息
export function updatePatientsStatus(data: PatientsVO) {
	return defHttp.put({ url: "/his/th-patients/update", data });
}

// 删除病人基本信息
export function deletePatients(id: string) {
	return defHttp.delete({ url: `/his/th-patients/delete?id=${id}` });
}

// 综合修改患者信息
export function putPatient_synthesis(data: any) {
	return defHttp.post({ url: "/his/patient/synthesis/patient/update", data });
}
// 综合添加患者信息
export function addPatient_synthesis(data: any) {
	return defHttp.post({ url: "/his/patient/synthesis/patient/create", data });
}

// 创建亲属信息
export function addPatient_fams(data: any) {
	return defHttp.post({ url: "/his/th-patient-fams/create", data });
}
// 更新亲属信息
export function putPatient_fams(data: any) {
	return defHttp.put({ url: "/his/th-patient-fams/update", data });
}
// 删除亲属信息
export function delPatient_fams(id: string) {
	return defHttp.delete({ url: `/his/th-patient-fams/delete?id=${id}` });
}
// 创建患者职业信息
export function addPatient_jobs(data: any) {
	return defHttp.post({ url: "/his/th-patient-jobs/create", data });
}
// 更新患者职业信息
export function putPatient_jobs(data: any) {
	return defHttp.put({ url: "/his/th-patient-jobs/update", data });
}
// 删除患者职业信息
export function delPatient_jobs(id: string) {
	return defHttp.delete({ url: `/his/th-patient-jobs/delete?id=${id}` });
}
// 创建医保信息
export function addPatient_insur(data: any) {
	return defHttp.post({ url: "/his/T-hpatient-insur/create", data });
}
// 更新医保信息
export function putPatient_insur(data: any) {
	return defHttp.put({ url: "/his/T-hpatient-insur/update", data });
}
// 删除医保信息
export function delPatient_insur(id: string) {
	return defHttp.delete({ url: `/his/T-hpatient-insur/delete?id=${id}` });
}

// 创建患者健康状态
export function addPatient_cond(data: any) {
	return defHttp.post({ url: "/his/th-patient-cond/create", data });
}
// 更新患者健康状态
export function putPatient_cond(data: any) {
	return defHttp.put({ url: "/his/th-patient-cond/update", data });
}
// 删除患者健康状态
export function delPatient_cond(id: string) {
	return defHttp.delete({ url: `/his/th-patient-cond/delete?condId=${id}` });
}
// 创建患者紧急联系人信息
export function addEmgcontacts(data: any) {
	return defHttp.post({ url: "/his/th-pat-emgcontacts/create", data });
}
// 更新患者紧急联系人信息
export function putEmgcontacts(data: any) {
	return defHttp.put({ url: "/his/th-pat-emgcontacts/update", data });
}
// 删除患者紧急联系人信息
export function delEmgcontacts(id: string) {
	return defHttp.delete({ url: `/his/th-pat-emgcontacts/delete?id=${id}` });
}
